#include "info.h"


BOOL info::registered = FALSE;

info::info(PCSTR winname)
{
	strcpy_s(name, winname);

	if (!registered)
	{
		WNDCLASSEX wcx;
		wcx.cbSize = sizeof(wcx);
		wcx.style = CS_HREDRAW | CS_VREDRAW;
		wcx.lpfnWndProc = callback;
		wcx.cbClsExtra = 0;
		wcx.cbWndExtra = 0;
		wcx.hInstance = GetModuleHandle(0);
		wcx.hIcon = LoadIcon(0, IDI_APPLICATION);
		wcx.hIconSm = 0;
		wcx.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcx.hCursor = LoadCursor(0, IDC_ARROW);
		wcx.lpszMenuName = NULL;
		wcx.lpszClassName = "output";
		wcx.lpszMenuName = NULL;

		RegisterClassEx(&wcx);
	}

	output = CreateWindow("output",
		name,
		WS_BORDER | WS_CAPTION | WS_POPUP | WS_VISIBLE | WS_SIZEBOX,
		CW_USEDEFAULT,
		CW_USEDEFAULT,
		600,
		800,
		NULL,
		NULL,
		GetModuleHandle(0),
		NULL);

	ShowWindow(output, SW_SHOWNORMAL);
}

LRESULT info::callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
